/**
 * @company : 版权所属 四川北星惯牌科技有限公司
 * @contact : 刘经理 19326416371
 **/
/*
 *mainBackground 背景图
 *mpCode  小程序码
 *avatarGroup  头像组
 */

export const posterFun = ({
	mainBackground,
	mpCode,
	avatarGroup = [],
	title,
	peopleTips,
	status,
	address,
	timeTips,
	price
}) => {
	let avatarGroupView = [] //头像组view
	if (avatarGroup && avatarGroup.length > 0) {
		avatarGroup = avatarGroup.splice(0, 3)
		avatarGroupView = avatarGroup.map((item, index) => {
			let trans = ''
			if (index && index !== 0) {
				trans = `translateX(-${50*index}%)`
			}
			return {
				type: "image",
				src: item,
				css: {
					width: '44rpx',
					height: '44rpx',
					borderRadius: '50%',
					// position: 'absolute',
					// top: 0,
					// left: '50%',
					// zIndex: 1
					transform: trans
				}
			}
		})
	}
	return {
		css: {
			width: '622rpx',
			height: '900rpx',
			background: '#2B2F33',
			borderRadius: '12rpx',
			display: 'flex',
			flexDirection: 'column',
			alignItems: 'center',
			boxSizing: 'border-box',
			// padding: '20rpx 32rpx',
			position: 'relative',
			overflow: 'hidden',
			justifyContent: 'space-between',
			boxShadow: '0rpx 0rpx 10rpx 2rpx rgba(190, 230, 252, 0.3)'
		},
		views: [{
				type: "image",
				src: mainBackground,
				css: {
					objectFit: 'cover',
					position: 'absolute',
					zIndex: -1,
					top: 0,
					left: 0,
					width: '622rpx',
					height: '900rpx',
				}
			},
			{ //倒计时
				type: "view",
				css: {
					display: 'flex',
					alignItems: 'center',
					alignSelf: 'flex-start',
					position: 'relative',
					zIndex: 1,
					width: '100%',
					padding: '20rpx 32rpx',
					background: 'linear-gradient(180deg, #0E0F0F  0%, transparent  100%)',

				},
				views: [{
					type: 'image',
					css: {
						width: '24rpx',
						height: '32rpx',
						marginRight: '8rpx'
					},
					src: '@/page_main/static/Subtract.png'
				}, {
					type: 'text',
					css: {
						fontWeight: 'bold',
						fontSize: '28rpx',
						color: '#ACADAE',
						marginLeft: '6rpx'
					},
					text: timeTips,
				}]
			},
			{ //底部信息
				type: "view",
				css: {
					display: 'flex',
					alignItems: 'center',
					position: 'relative',
					boxSizing: 'border-box',
					zIndex: 1,
					width: '100%',
					padding: '20rpx 32rpx',
					background: 'linear-gradient(to top, #0E0F0F  0%, transparent  100%)',
					justifyContent: 'space-between'
				},
				views: [{
						type: 'view',
						css: {
							display: 'flex',
							flex: 1,
							flexDirection: 'column',
						},
						views: [{
								type: 'text',
								css: {
									fontWeight: 'bold',
									fontSize: '28rpx',
									color: '#FFFFFF',
									width: '100%',
									lineHeight: '40rpx',
									marginBottom: '10rpx',
									textOverflow: 'ellipsis',
									whiteSpace: 'nowrap',
									lines: 1,
									overflow: 'hidden',
								},
								text: title,
							},
							{
								type: 'text',
								css: {
									fontSize: '26rpx',
									color: '#FFFFFF',
									width: '100%',
									lineHeight: '40rpx',
									textOverflow: 'ellipsis',
									whiteSpace: 'nowrap',
									lines: 1,
									overflow: 'hidden',
								},
								text: address,
							},
							{
								type: 'text',
								css: {
									fontWeight: 'bold',
									fontSize: '28rpx',
									color: '#9BDEB5',
									lineHeight: '40rpx',
								},
								text: price,
							},
						]
					},
					{ //小程序码图片
						type: "image",
						src: mpCode,
						css: {
							width: '184rpx',
							height: '184rpx',
							flexShink: 0,
							marginLeft: '20rpx',
							borderRadius: '12rpx',
						}
					}
				]

			},
		]
	}
}